package com.ddm.service.impl;

import com.ddm.mapper.EmployeeMapper;
import com.ddm.service.IEmployeeService;
import com.entity.Employee;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by he on 2025/3/4 13:31
 */
@Service
public class EmployeeServiceImpl implements IEmployeeService {
    // 注入EmployeeMapper
    @Autowired
    private EmployeeMapper employeeMapper;


    // 根据员工id查询员工
    @Override
    public Employee selectEmployeeById(Integer EmployeeId) {
        return employeeMapper.selectEmployeeById(EmployeeId);
    }

    // 根据员工姓名查询员工
    @Override
    public Employee selectEmployeeByName(String EmployeeName) {
        return employeeMapper.selectEmployeeByName(EmployeeName);
    }

    // 查询所有员工
    @Override
    public List<Employee> listAllEmployees() {
        return employeeMapper.listAllEmployees();
    }

    // 根据员工信息查询员工列表
    @Override
    public List<Employee> selectEmployeeList(Employee employee) {
        return employeeMapper.selectEmployeeList(employee);
    }

    // 增加员工
    @Override
    public int insertEmployee(Employee employee)     {
        return employeeMapper.insertEmployee(employee);
    }

    // 修改员工信息
    @Override
    public int updateEmployee(Employee employee) {
        return employeeMapper.updateEmployee(employee);
    }

    // 根据id删除员工
    @Override
    public int deleteEmployeeById(Integer EmployeeId) {
        return employeeMapper.deleteEmployeeById(EmployeeId);
    }


    // 根据id数组删除员工
    @Override
    public int deleteEmployeeByIds(Integer[] EmployeeIds) {
        return employeeMapper.deleteEmployeeByIds(EmployeeIds);
    }

    // 根据员工类型查询员工列表
    @Override
    public List<Employee> selectEmployeesByType(String employeeType) {
        return employeeMapper.selectEmployeesByType(employeeType);
    }

    // 根据员工Name查询员工列表
    @Override
    public List<Employee> selectEmployeesByName(String employeeName) {
        return employeeMapper.selectEmployeesByName(employeeName);
    }
    // 根据员工Id查询员工列表
    @Override
    public List<Employee> selectEmployeesById(int employeeId) {
        return employeeMapper.selectEmployeesById(employeeId);
    }

}
